In [1]:
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Click here to toggle on/off the raw code."></form>''')
Out[1]:
In [2]:
import nltk, requests, StringIO, pandas as pd, pprint, json, re, sys
from pyspark import SparkContext
from pixiedust.display import *
!pip install wordcloud --user nltk
from wordcloud import WordCloud, STOPWORDS
Pixiedust database opened successfully
Requirement already satisfied: wordcloud in /gpfs/global_fs01/sym_shared/YPProdSpark/user/sa40-897700f6b3fee3-ac63c96e2357/.local/lib/python2.7/site-packages
Requirement already satisfied: nltk in /usr/local/src/bluemix_jupyter_bundle.v36/notebook/lib/python2.7/site-packages
The credentials for accessing the surveys.csv
file are added to the cell in a function. With these credentials, you can use the helper function to load the data file into a pandas.DataFrame
.
Note: When you select the Insert to code
function, a code cell with a dictionary is created for you. Adjust the credentials in the Python dictionary to correspond with the credentials inserted by the Insert to code
function and run the dictionary code cell. The access credentials to the Object Storage instance in the dictionary are provided for convenience for later usage.
In [4]:
# The code was removed by DSX for sharing.
In [ ]:
# The code was removed by DSX for sharing.
In [ ]:
In [5]:
surveys_df = pd.read_csv(get_object_storage_file_with_credentials_bba657a78df141959b30542141270d03('WSUSymposium', 'surveys.csv'))
In [6]:
surveys_df.head()
Out[6]:
SectionName
dept
CommentText
0
Room
a03a76f447a2a78a14c420968b7d6321b903bc18d6d090...
They cleaned at night time, they were fast & q...
1
Meals
a03a76f447a2a78a14c420968b7d6321b903bc18d6d090...
The salads were good. Some of the main entree...
2
Tests and Treatment
a03a76f447a2a78a14c420968b7d6321b903bc18d6d090...
They asked if I understood & if it was OK to p...
3
Personal Issues
a03a76f447a2a78a14c420968b7d6321b903bc18d6d090...
The nurses were very helpful & caring. Treate...
4
Meals
aa79e7b740b862d35591300ccd06885f864eb2160222b8...
Limited selection. Hours of availability.
In [7]:
surveys_df.tail()
Out[7]:
SectionName
dept
CommentText
995
Meals
ab9d1b895c331418376465a13e9a49224c817e0ef90c91...
Tray had regular items - when I was to get dia...
996
Personal Issues
ab9d1b895c331418376465a13e9a49224c817e0ef90c91...
Any problems fixed at once.
997
Meals
538671ce4a524e33b0585dfb298a50f06e35f68ccf0c39...
Always on time.
998
Room
538671ce4a524e33b0585dfb298a50f06e35f68ccf0c39...
Didn't mop floors only change trash.
999
Personal Issues
538671ce4a524e33b0585dfb298a50f06e35f68ccf0c39...
Nurses on B1 are great.
In [8]:
surveys_df.dept.unique()
Out[8]:
array(['a03a76f447a2a78a14c420968b7d6321b903bc18d6d090f26205ca784e9fd730',
'aa79e7b740b862d35591300ccd06885f864eb2160222b83107f7c7493153af63',
'fc8e9a93208787d3385777da843db934c2a6babbca89c500f06b0ea2a4b34daa',
'b148428966e70b9778ea073168b1f0c0ccc1b8bfd7027a6641835e9200920ba7',
'ce34e185e1085451ec06d40a63363886a643b7ab102ac8c236dee51c2cc238da',
'ab9d1b895c331418376465a13e9a49224c817e0ef90c91d1d2b70795177fb5aa',
'dbbfc0fe8bcca58ae13a3d6c997cd353dfe7b90202dbc6ab4c7af3d28bc94711',
'82c07801023ca5caad6fb81bb5958dbf3d095191c226a4d512e125b4aaa16506',
'3e4423f2c0fea026561654892fb2025f52549af39a8bf7c7e8669f47145cb3d2',
'fbf29199bce1917852dcc5d2f9851f592d416d7abfee22688c5ada60e6367e8f',
'a7865dc86bb17f592d5ba2ac3deeb93b5c68496b97463c8343f2670e710b0467',
'af80202c5afd453e7f482e264c89fe1f07dd463612aa9f7e2d453dfcf26c62c4',
'fd4a711ed9bde9026f91d73c201c94611156e36cf3793f8c6e1b66a95f7cc795',
'12fb53bbe147bfe9b8358d6f96b9e9d14d40b70b5a8147d910293d7827a59cf8',
'052cec7e4556f1cfac68e22fa15d966126525c80acf185c87eeff1e0c18e5c3f',
'3e7b5c0527269b440635089ddcf732c7f2b52a8ee2c00affbc9af14e8802e747',
'538671ce4a524e33b0585dfb298a50f06e35f68ccf0c39b108f671ba225c411d',
'5dfe4ad49ac214cb0df24f6e17d15d6322768bfcfce0471fe75500324441e5da',
'1b0fc7680a91a55290d4bf89ecdd4ffe3bbd49fd96516fc07d93dcc1af1f0e66',
'1583c18cfef581063745ac1c4051346c80bdb1926900dd42faefff6544c31c8f',
'343bc223e9c8ae11c11d1775ea10c4823d8aa36a3c53e9c58a4cd2fd766d89bd',
'c4e77f20870ab88b84c5a4507c98f08a1e8c58c6f462c6b9f2537f0f88794839',
'ef3506531fdd7efe0654993b158eb412bf7846280688b46d925ed766b763cf6d',
'42f0db1bb17c4835a63f30c15cbc27b254130bc002c4d9dff2f93b3fec65595e',
'ad14129f32d00ea2922263893de8ae572bc7404057026581dedd94c63d6d311b',
'2986be987446b7d82f2129ea740714979b397717acb041efc53c229cd5d04c9e',
'5654fadbc830a72d252e3edc72a9646c8d2eeb5d79b752e791874314fb326647',
'cb42f86c9e4bb274de260a816e91c84bdd0ca1c4f74f559256ffd07e8b17db95',
'bc30e3d1315ae40489f10e3cb0112b5418ee4618e177e35657fdd20ea56f7a67',
'b44d5d35d16e08530d517da8f1613921281252f8c1a07d8d9d72802d8e150e96',
'8239692352a218f50e2a4befe1bf3857a331f7294d8d2f157f765eb47bb3fa9f',
'0ff7b5d53cf92079fa6fd0d06a96b820b71af250c05502f9d54994156970448e',
'7546ae10b2443189a1c84f304a0a1578844b4b829c6c386df1d0407a63eaf784'], dtype=object)
In [9]:
surveys_df.SectionName.unique()
Out[9]:
array(['Room', 'Meals', 'Tests and Treatment', 'Personal Issues'], dtype=object)
In [10]:
surveys_df['CommentText'] = surveys_df['CommentText'].str.lower()
surveys_df.head()
Out[10]:
SectionName
dept
CommentText
0
Room
a03a76f447a2a78a14c420968b7d6321b903bc18d6d090...
they cleaned at night time, they were fast & q...
1
Meals
a03a76f447a2a78a14c420968b7d6321b903bc18d6d090...
the salads were good. some of the main entree...
2
Tests and Treatment
a03a76f447a2a78a14c420968b7d6321b903bc18d6d090...
they asked if i understood & if it was ok to p...
3
Personal Issues
a03a76f447a2a78a14c420968b7d6321b903bc18d6d090...
the nurses were very helpful & caring. treate...
4
Meals
aa79e7b740b862d35591300ccd06885f864eb2160222b8...
limited selection. hours of availability.
In [11]:
nltk.download("stopwords")
def removePunctuation(text):
"""Removes punctuation, changes to lowercase, and strips leading and trailing spaces.
Note:
Only spaces, letters, and numbers should be retained. Other characters should should be
eliminated. (e.g. it's becomes its)
Args:
text (str): A string.
Returns:
str: The cleaned up string.
"""
letters_only = re.sub("[^a-zA-Z]", " ", text)
words = letters_only.lower().split()
return(words)
def removeWords(text):
from nltk.corpus import stopwords # Import the stop word list
"""Removes punctuation, changes to lowercase, and strips leading and trailing spaces.
Note:
Only spaces, letters, and numbers should be retained. Other characters should should be
eliminated. (e.g. it's becomes its)
Args:
text (str): A string.
Returns:
str: The cleaned up string.
"""
stops = set(stopwords.words("english"))
meaningful_words = [w for w in text if not w in stops]
return(" ".join(meaningful_words))
surveys_df['CommentText'] = surveys_df['CommentText'].apply(removePunctuation)
surveys_df_trim = surveys_df
surveys_df_trim['CommentText'] = surveys_df['CommentText'].apply(removeWords)
[nltk_data] Downloading package stopwords to /gpfs/fs01/user/sa40-8977
[nltk_data] 00f6b3fee3-ac63c96e2357/nltk_data...
[nltk_data] Package stopwords is already up-to-date!
In [12]:
surveys_df = surveys_df.set_index(surveys_df["dept"])
surveys_df.drop(['dept'], axis=1, inplace=True)
So far we've explored the data and performed several manipulations in Pandas. Pandas is a great library, but it will not provide us with the distributed computing facilities we require for large scale analysis. Let's move this into Spark and see what we can work with.
Once in Spark we can visualize our dataset with the excellent Pixiedust library by IBM.
In [30]:
from pyspark.sql import SQLContext
print sc
sqlCtx = SQLContext(sc)
spark_df = sqlCtx.createDataFrame(surveys_df)
display(spark_df)
type: struct
field:
{'metadata': {}, 'type': 'string', 'name': 'SectionName', 'nullable': True}
{'metadata': {}, 'type': 'string', 'name': 'CommentText', 'nullable': True}
Showing 100 of 1000
SectionName
CommentText
SectionName
CommentText
Room
cleaned night time fast quiet
Meals
salads good main entrees kinda dry bland
Tests and Treatment
asked understood ok proceed
Personal Issues
nurses helpful caring treated like person work
Meals
limited selection hours availability
Tests and Treatment
lost pounds days limited dinners lunch box meals due testing duration awaiting results diabetic type one meal per day unsatisfactory unhealthy inadequate stay stressful
Personal Issues
spent considerable time wheelchair waiting tested administrative office nuclear imaging associate bragging pictures mouse took w cell phone roaming wing mouse came kitchen via vent duct
Room
cleaning lady always courteous
Meals
meals good think lot taste factor due meds
Tests and Treatment
always knew tests never wait long
Personal Issues
never complaints staff always available needed
Personal Issues
except pharmacist discussed length meds anti coagulation therapy staff discuss discharge plans thoroughly maybe nurse assumed would know even doctor told conta
Room
respectful considerate
Meals
enjoyed meals found food service staff helpful friendly
Tests and Treatment
felt comfortable medical staff
Room
room clean daily
Meals
first use eating diet food got use good
Meals
meals one excellent nd one ordered phone husband husband delivered room mine call nd time husband meal supposed include rice
Meals
sometimes broasted potatoes super dry
Meals
service great
Personal Issues
overall caring staff time walk hospital doctors nurses staff best save life thank
Room
never saw one
Personal Issues
make complaints
Personal Issues
staff p incredibly caring competent
Room
cleaning lady got new paper morning paid paper refused tip went newspaper break time nice
Meals
got evening snacks brought room
Tests and Treatment
x rays therapy treatments good
Personal Issues
recall comments emotional needs complaints every thing good except one bad experience asst nurse asst nurse bad attitude like bothering set leg massage equipment right
Meals
mostly liquid diet
Meals
listed additives aspartame green tea allergy would sometimes get tray call every meal made difficult
Tests and Treatment
found allergic electrodes hard deal darkened skin itching rash staff put electrodes get read take helped
Personal Issues
neurology floor nice friendly
Meals
going home person served food got name phone soup hospital good soup told make tasty
Tests and Treatment
tests
Meals
eat much
Personal Issues
complained iv burning hrs one nurse looked said removed caused infection next day swollen hurt one nurse hours late giving steroids nurse ever helped
Personal Issues
occasion staff seemed slow answer summons understood also patients care
Meals
sick eat days
Personal Issues
exceptional nurses dec th room p floor jessica mandy alex outstanding attitude overall demeanor competence
Room
cleaned room dear always cheerful
Meals
staff friendly made corrections meals accurately
Personal Issues
icu nurse mallary brake top notch always caring concerned always attended needs right away lucky staff
Meals
ate little hospital sick
Meals
menu options made available nd day stay
Room
room cold get someone heat took two days
Meals
good services
Meals
never many foods w additives preservatives hospital converting new computer system great difficulty w diet took days resolve nurses spent hours
Meals
food always ordered
Meals
lettuce salad old nd salad fresh
Tests and Treatment
staff awesome
Room
seemed happy job always happy pleasant
Tests and Treatment
everyone one professional
Personal Issues
staff great doctors robotic know suggest thing cause educated looked every thing said poor doctors personable
Personal Issues
thank nurse nurse shannon birth unit stayed baby girl great stay rd time back thanks
Meals
nature surgery diet limited
Personal Issues
whole experience close one would expect start hotel
Room
stay sheets never changed
Room
sick sedated hosp noticed robe slippers chair lost called security robe slippers filed report terrible
Meals
sick could eat good
Personal Issues
say
Tests and Treatment
gi team scared crap family speaking liver know anything liver team discussed seemed caused undo stress team made rounds performed test kept extra day unnecessaril
Personal Issues
thankful staff allowing wife stay help ease stress fears danielle na awesome imelda regular nurses seemed like much going bothered
Meals
food service best hospital stay everyone nice respectful
Personal Issues
guys hospital stay left emotional stress stop crying thru hospital
Meals
food good people polite friendly
Room
week cleaned
Meals
supposed ketogenic diet every meal complete carbs dry sometimes burnt start calling meal order never called
Tests and Treatment
every doctor assigned daily neurologist different speak english well stubborn decision making take considerations worries factors
Personal Issues
neurologists explain things well seemed change minds often experimenting w medications wishes food poor nurses nice seemed busy understaffed meet needs
Meals
mold pita bread discovered visitor mine
Tests and Treatment
infectious doctor staff rude told nurse welcome room
Room
bathtub drain properly
Meals
pleased quality meals
Tests and Treatment
test treatments patient
Personal Issues
bathtub drain properly
Room
friendly
Meals
never ate hospital food looked fair eat wife purchased food hospital subway avolon
Tests and Treatment
told treatment would done certain time actually got done much later understand
Personal Issues
like fact wife told go stairs wheelchair released
Tests and Treatment
waited er hours seen doctor nurse
Personal Issues
asked several people help waiting hours seen nobody seemed care several employees told normal would get could feel cared
Meals
something always missing order placed
Tests and Treatment
sometimes would sit latrine someone would come help
Personal Issues
process discharging terrible nothing done orderly manner one discharge workers said talk wife overloaded
Room
one ever cleaned room dirty water standing shower could even take cold shower degree room
Meals
food served npo
Tests and Treatment
propanolol midnight nurse procardit never gave propanolol
Personal Issues
degrees room dirty water standing shower maintenance nothing shame left ama made miserable
Room
cleaning lady came told discharged took garbage said clean room bathroom leave ok
Room
never seen one clean room dump trash
Meals
get parts meal time
Personal Issues
icu much often
Personal Issues
pleased stay hospitals
Personal Issues
thank much make difficult situation pleasant experience possible grateful care received carlotta koci
Meals
unacceptable
Room
caution needed cleaning prevent easy spread diseases
Meals
patients given chance make choices food preference
Tests and Treatment
big problem patient included treatment decisions
Room
good
Personal Issues
varied varied icu nurses outstanding
Execution time: 0.02s
In [1]:
countsBySection = spark_df.groupby("SectionName").count()
display(countsBySection)
NameErrorTraceback (most recent call last)
<ipython-input-1-55d6327fc5ae> in <module>()
----> 1 countsBySection = spark_df.groupby("SectionName").count()
2 display(countsBySection)
NameError: name 'spark_df' is not defined
In [16]:
import brunel
words = spark_df.select("CommentText").rdd.map(lambda r: r[0])
counts = words.flatMap(lambda line: re.split('\W+', line.lower().strip())) \
.filter(lambda x: len(x) > 2) \
.map(lambda word: (word, 1)) \
.reduceByKey(lambda a, b: a + b) \
.map(lambda x: (x[1], x[0])).sortByKey(False) \
.map(lambda x: (x[1], x[0]))
counts_df = pd.DataFrame(counts.take(10))
#counts_df = counts_df.transpose()
cols = ['Word', 'Count']
counts_df.columns = cols
%brunel data('counts_df') bar x(Word) y(Count) sort(Count) transpose :: width=800, height=640
Out[16]:
Now that we have an idea of our data, we can move into our actual modeling and analysis. An interesting thought exercise might be to determine what words are mostly associated with a good sentiment or a bad sentiment.
We will use the Spark MLlib library Word2Vec to find the cosine distance synonyms for terms 'good' and 'bad'.
In [17]:
from pyspark.mllib.feature import Word2Vec
inp = words.map(lambda row: row.split(" "))
word2vec = Word2Vec()
model = word2vec.fit(inp)
In [18]:
synonyms = model.findSynonyms('good', 40)
for word, cosine_distance in synonyms:
print "{}: {}".format(word, cosine_distance)
experience: 0.154700975025
overall: 0.139902208244
person: 0.125978767417
job: 0.122228895409
friendly: 0.104854554968
experiences: 0.103755003973
treatment: 0.101109680611
clean: 0.0980236286156
surgery: 0.0972694884535
kind: 0.0951914662681
housekeeping: 0.0942276150766
op: 0.0926265801651
except: 0.0914596729724
nice: 0.0906748621121
issues: 0.0821827491352
pleased: 0.0809665851722
regular: 0.0796751967927
tell: 0.0794185167154
pre: 0.0786618170825
min: 0.0760293282459
feel: 0.075414744987
high: 0.07199356965
minutes: 0.071883983945
med: 0.0713922533721
testing: 0.0703375929525
expected: 0.0685623880491
issue: 0.0665094503288
mri: 0.0664965070635
stayed: 0.0663873692741
work: 0.0645797717881
negative: 0.0623261164327
certain: 0.0553267515788
attention: 0.0538616615342
young: 0.0533679422343
main: 0.0503007568226
b: 0.050099922875
many: 0.0492043835877
taking: 0.0490165040064
let: 0.0474340708565
emergency: 0.0467366621862
In [20]:
values = map(lambda x: x[1], synonyms)
labels = map(lambda x: x[0], synonyms)
syn_df = pd.DataFrame(synonyms)
cols = ['term', 'score']
syn_df.columns = cols
%brunel data('syn_df') bar x(term) y(score) sort(score) transpose :: width=800, height=640
Out[20]:
In [21]:
%matplotlib inline
import matplotlib.pyplot as plt
!pip install wordcloud --user nltk
from wordcloud import WordCloud, STOPWORDS
wordList = " ".join([x[0] for x in synonyms for times in range(0, int(x[1]*10))])
wordcloud = WordCloud(stopwords=STOPWORDS,
background_color='white',
relative_scaling=.5,
width=2400,
height=2000,
).generate(wordList)
plt.imshow(wordcloud)
plt.axis('off')
plt.show()
/usr/local/src/bluemix_jupyter_bundle.v36/notebook/lib/python2.7/site-packages/ipykernel/pylab/config.py:66: DeprecationWarning: metadata {'config': True} was set from the constructor. Metadata should be set using the .tag() method, e.g., Int().tag(key1='value1', key2='value2')
inline backend."""
/usr/local/src/bluemix_jupyter_bundle.v36/notebook/lib/python2.7/site-packages/ipykernel/pylab/config.py:71: DeprecationWarning: metadata {'config': True} was set from the constructor. Metadata should be set using the .tag() method, e.g., Int().tag(key1='value1', key2='value2')
'retina', 'jpeg', 'svg', 'pdf'.""")
/usr/local/src/bluemix_jupyter_bundle.v36/notebook/lib/python2.7/site-packages/ipykernel/pylab/config.py:85: DeprecationWarning: metadata {'config': True} was set from the constructor. Metadata should be set using the .tag() method, e.g., Int().tag(key1='value1', key2='value2')
use `figure_formats` instead)""")
/usr/local/src/bluemix_jupyter_bundle.v36/notebook/lib/python2.7/site-packages/ipykernel/pylab/config.py:95: DeprecationWarning: metadata {'config': True} was set from the constructor. Metadata should be set using the .tag() method, e.g., Int().tag(key1='value1', key2='value2')
"""
/usr/local/src/bluemix_jupyter_bundle.v36/notebook/lib/python2.7/site-packages/ipykernel/pylab/config.py:114: DeprecationWarning: metadata {'config': True} was set from the constructor. Metadata should be set using the .tag() method, e.g., Int().tag(key1='value1', key2='value2')
""")
/usr/local/src/bluemix_jupyter_bundle.v36/notebook/lib/python2.7/site-packages/ipykernel/pylab/config.py:44: DeprecationWarning: InlineBackend._config_changed is deprecated: use @observe and @unobserve instead.
def _config_changed(self, name, old, new):
/usr/local/src/bluemix_jupyter_bundle.v36/notebook/lib/python2.7/site-packages/traitlets/traitlets.py:770: DeprecationWarning: A parent of InlineBackend._config_changed has adopted the new @observe(change) API
clsname, change_or_name), DeprecationWarning)
Requirement already satisfied: wordcloud in /gpfs/global_fs01/sym_shared/YPProdSpark/user/sa40-897700f6b3fee3-ac63c96e2357/.local/lib/python2.7/site-packages
Requirement already satisfied: nltk in /usr/local/src/bluemix_jupyter_bundle.v36/notebook/lib/python2.7/site-packages
In [22]:
synonyms = model.findSynonyms('bad', 10)
for word, cosine_distance in synonyms:
print "{}: {}".format(word, cosine_distance)
food: 0.0710959105657
know: 0.0695198505295
took: 0.0688279619572
room: 0.0682156205261
say: 0.0678251663028
hospital: 0.0677300174278
people: 0.0676665933298
meals: 0.0676526559983
complaints: 0.0672124836255
best: 0.0666773356456
In [23]:
values = map(lambda x: x[1], synonyms)
labels = map(lambda x: x[0], synonyms)
syn_df = pd.DataFrame(synonyms)
cols = ['term', 'score']
syn_df.columns = cols
%brunel data('syn_df') bar x(term) y(score) sort(score) transpose :: width=800, height=640
Out[23]:
Sentiment analysis is relatively trivial at this stage, and most survey vendors provide a basic NLP implementation. I feel we can go deeper and perhaps find a larger insight with more sophisticated analysis. Let's leverage IBM's Watson ML platform via RESTful API calls and see what we can determine.
Tone Analyzer uses linguistic analysis to detect three types of tones in written text: emotions, social tendencies, and writing style. Use the Tone Analyzer service to understand emotional context of conversations and communications. Use this insight to respond in an appropriate manner.
In [31]:
!pip install watson_developer_cloud --user nltk
import json
from watson_developer_cloud import ToneAnalyzerV3
tone_analyzer = ToneAnalyzerV3(
username='e6eb62c2-cb6f-4036-9ad8-666afd8cd185',
password='wxoRyaPj1d4m',
version='2016-02-11')
toneRows = spark_df.select("CommentText").take(100)
tones = []
for r in toneRows:
tones.append(json.dumps(tone_analyzer.tone(text=str(r)), indent=2))
Requirement already satisfied: watson_developer_cloud in /gpfs/global_fs01/sym_shared/YPProdSpark/user/sa40-897700f6b3fee3-ac63c96e2357/.local/lib/python2.7/site-packages
Requirement already satisfied: nltk in /usr/local/src/bluemix_jupyter_bundle.v36/notebook/lib/python2.7/site-packages
Requirement already satisfied: requests<3.0,>=2.0 in /usr/local/src/bluemix_jupyter_bundle.v36/notebook/lib/python2.7/site-packages (from watson_developer_cloud)
Requirement already satisfied: pysolr<4.0,>=3.3 in /gpfs/global_fs01/sym_shared/YPProdSpark/user/sa40-897700f6b3fee3-ac63c96e2357/.local/lib/python2.7/site-packages (from watson_developer_cloud)
In [27]:
from collections import defaultdict
score_list = defaultdict(list)
# Build Dict of Tonal Scores
for i in tones:
data = json.loads(str(i))
for r in data['document_tone']['tone_categories']:
for score in r['tones']:
score_list[score['tone_name']].append(score['score'])
# Average Tonal Sentiment by Tone Category
avgDict = {}
for k,v in score_list.iteritems():
# v is the list of grades for student k
avgDict[k] = sum(v)/ float(len(v))
print("Tone Category Averages")
print(json.dumps(avgDict, indent=2))
# Display Tonal Scores Human Readable
for i in tones:
data = json.loads(str(i))
for r in data['document_tone']['tone_categories']:
print(r['category_name'])
print("-" * len(r['category_name']))
for j in r['tones']:
print(j['tone_name'].ljust(20),(str(round(j['score'] * 100,1)) + "%").rjust(10))
print()
Tone Category Averages
{
"Disgust": 0.18007970000000004,
"Tentative": 0.15502543,
"Emotional Range": 0.1244288499999999,
"Joy": 0.15822116999999997,
"Sadness": 0.29244264999999997,
"Confident": 0.15959028,
"Extraversion": 0.4587855200000001,
"Agreeableness": 0.58267708,
"Conscientiousness": 0.22149726000000006,
"Openness": 0.14541356000000005,
"Analytical": 0.03888428,
"Anger": 0.23846152000000007,
"Fear": 0.12431748000000002
}
Emotion Tone
------------
(u'Anger ', ' 11.5%')
(u'Disgust ', ' 13.6%')
(u'Fear ', ' 21.8%')
(u'Joy ', ' 30.9%')
(u'Sadness ', ' 13.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 0.2%')
(u'Conscientiousness ', ' 21.0%')
(u'Extraversion ', ' 53.2%')
(u'Agreeableness ', ' 54.6%')
(u'Emotional Range ', ' 7.1%')
()
Emotion Tone
------------
(u'Anger ', ' 22.5%')
(u'Disgust ', ' 6.3%')
(u'Fear ', ' 10.4%')
(u'Joy ', ' 25.0%')
(u'Sadness ', ' 27.3%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 85.7%')
()
Social Tone
-----------
(u'Openness ', ' 15.3%')
(u'Conscientiousness ', ' 5.0%')
(u'Extraversion ', ' 50.6%')
(u'Agreeableness ', ' 22.1%')
(u'Emotional Range ', ' 0.7%')
()
Emotion Tone
------------
(u'Anger ', ' 25.9%')
(u'Disgust ', ' 33.5%')
(u'Fear ', ' 5.9%')
(u'Joy ', ' 2.3%')
(u'Sadness ', ' 47.3%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 41.1%')
(u'Conscientiousness ', ' 26.1%')
(u'Extraversion ', ' 40.2%')
(u'Agreeableness ', ' 57.5%')
(u'Emotional Range ', ' 16.1%')
()
Emotion Tone
------------
(u'Anger ', ' 21.1%')
(u'Disgust ', ' 21.9%')
(u'Fear ', ' 2.5%')
(u'Joy ', ' 21.5%')
(u'Sadness ', ' 28.9%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 48.8%')
(u'Conscientiousness ', ' 13.4%')
(u'Extraversion ', ' 60.9%')
(u'Agreeableness ', ' 74.8%')
(u'Emotional Range ', ' 0.2%')
()
Emotion Tone
------------
(u'Anger ', ' 34.7%')
(u'Disgust ', ' 12.2%')
(u'Fear ', ' 11.9%')
(u'Joy ', ' 4.7%')
(u'Sadness ', ' 46.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 3.1%')
(u'Conscientiousness ', ' 32.2%')
(u'Extraversion ', ' 29.4%')
(u'Agreeableness ', ' 49.2%')
(u'Emotional Range ', ' 6.1%')
()
Emotion Tone
------------
(u'Anger ', ' 44.4%')
(u'Disgust ', ' 8.7%')
(u'Fear ', ' 9.4%')
(u'Joy ', ' 2.5%')
(u'Sadness ', ' 47.2%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 4.4%')
(u'Conscientiousness ', ' 37.2%')
(u'Extraversion ', ' 9.8%')
(u'Agreeableness ', ' 42.0%')
(u'Emotional Range ', ' 4.2%')
()
Emotion Tone
------------
(u'Anger ', ' 50.6%')
(u'Disgust ', ' 7.3%')
(u'Fear ', ' 29.5%')
(u'Joy ', ' 0.9%')
(u'Sadness ', ' 28.8%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 33.3%')
(u'Conscientiousness ', ' 57.2%')
(u'Extraversion ', ' 64.8%')
(u'Agreeableness ', ' 36.0%')
(u'Emotional Range ', ' 45.2%')
()
Emotion Tone
------------
(u'Anger ', ' 15.5%')
(u'Disgust ', ' 46.5%')
(u'Fear ', ' 5.3%')
(u'Joy ', ' 16.1%')
(u'Sadness ', ' 17.8%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 94.3%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 8.4%')
(u'Conscientiousness ', ' 15.1%')
(u'Extraversion ', ' 74.4%')
(u'Agreeableness ', ' 65.4%')
(u'Emotional Range ', ' 4.2%')
()
Emotion Tone
------------
(u'Anger ', ' 13.5%')
(u'Disgust ', ' 12.5%')
(u'Fear ', ' 9.9%')
(u'Joy ', ' 23.4%')
(u'Sadness ', ' 32.7%')
()
Writing Tone
------------
(u'Analytical ', ' 68.8%')
(u'Confident ', ' 61.8%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 20.6%')
(u'Conscientiousness ', ' 2.8%')
(u'Extraversion ', ' 17.0%')
(u'Agreeableness ', ' 41.4%')
(u'Emotional Range ', ' 0.0%')
()
Emotion Tone
------------
(u'Anger ', ' 9.6%')
(u'Disgust ', ' 8.3%')
(u'Fear ', ' 9.8%')
(u'Joy ', ' 38.5%')
(u'Sadness ', ' 20.4%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 95.6%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 0.0%')
(u'Conscientiousness ', ' 25.2%')
(u'Extraversion ', ' 7.6%')
(u'Agreeableness ', ' 30.6%')
(u'Emotional Range ', ' 5.7%')
()
Emotion Tone
------------
(u'Anger ', ' 29.8%')
(u'Disgust ', ' 2.3%')
(u'Fear ', ' 6.5%')
(u'Joy ', ' 1.7%')
(u'Sadness ', ' 68.4%')
()
Writing Tone
------------
(u'Analytical ', ' 50.7%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 94.6%')
()
Social Tone
-----------
(u'Openness ', ' 34.9%')
(u'Conscientiousness ', ' 28.7%')
(u'Extraversion ', ' 58.2%')
(u'Agreeableness ', ' 68.0%')
(u'Emotional Range ', ' 15.2%')
()
Emotion Tone
------------
(u'Anger ', ' 36.1%')
(u'Disgust ', ' 12.9%')
(u'Fear ', ' 27.8%')
(u'Joy ', ' 0.2%')
(u'Sadness ', ' 41.1%')
()
Writing Tone
------------
(u'Analytical ', ' 40.1%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 61.5%')
()
Social Tone
-----------
(u'Openness ', ' 61.7%')
(u'Conscientiousness ', ' 11.6%')
(u'Extraversion ', ' 60.7%')
(u'Agreeableness ', ' 77.6%')
(u'Emotional Range ', ' 2.9%')
()
Emotion Tone
------------
(u'Anger ', ' 27.8%')
(u'Disgust ', ' 17.3%')
(u'Fear ', ' 12.7%')
(u'Joy ', ' 10.3%')
(u'Sadness ', ' 36.5%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 35.9%')
(u'Conscientiousness ', ' 23.5%')
(u'Extraversion ', ' 62.2%')
(u'Agreeableness ', ' 60.6%')
(u'Emotional Range ', ' 2.5%')
()
Emotion Tone
------------
(u'Anger ', ' 16.5%')
(u'Disgust ', ' 24.1%')
(u'Fear ', ' 0.3%')
(u'Joy ', ' 48.2%')
(u'Sadness ', ' 2.5%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 17.1%')
(u'Conscientiousness ', ' 28.0%')
(u'Extraversion ', ' 45.6%')
(u'Agreeableness ', ' 57.6%')
(u'Emotional Range ', ' 23.2%')
()
Emotion Tone
------------
(u'Anger ', ' 25.7%')
(u'Disgust ', ' 35.9%')
(u'Fear ', ' 11.8%')
(u'Joy ', ' 2.7%')
(u'Sadness ', ' 39.1%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 75.2%')
()
Social Tone
-----------
(u'Openness ', ' 19.9%')
(u'Conscientiousness ', ' 26.5%')
(u'Extraversion ', ' 50.6%')
(u'Agreeableness ', ' 65.6%')
(u'Emotional Range ', ' 6.1%')
()
Emotion Tone
------------
(u'Anger ', ' 21.6%')
(u'Disgust ', ' 48.0%')
(u'Fear ', ' 13.5%')
(u'Joy ', ' 13.7%')
(u'Sadness ', ' 8.8%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 7.7%')
(u'Conscientiousness ', ' 33.8%')
(u'Extraversion ', ' 51.5%')
(u'Agreeableness ', ' 68.2%')
(u'Emotional Range ', ' 38.5%')
()
Emotion Tone
------------
(u'Anger ', ' 11.8%')
(u'Disgust ', ' 26.4%')
(u'Fear ', ' 5.1%')
(u'Joy ', ' 35.4%')
(u'Sadness ', ' 12.4%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 3.8%')
(u'Conscientiousness ', ' 41.3%')
(u'Extraversion ', ' 36.9%')
(u'Agreeableness ', ' 21.5%')
(u'Emotional Range ', ' 49.5%')
()
Emotion Tone
------------
(u'Anger ', ' 24.0%')
(u'Disgust ', ' 10.7%')
(u'Fear ', ' 1.1%')
(u'Joy ', ' 7.3%')
(u'Sadness ', ' 60.2%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 44.7%')
()
Social Tone
-----------
(u'Openness ', ' 4.6%')
(u'Conscientiousness ', ' 50.7%')
(u'Extraversion ', ' 43.5%')
(u'Agreeableness ', ' 72.9%')
(u'Emotional Range ', ' 66.8%')
()
Emotion Tone
------------
(u'Anger ', ' 41.0%')
(u'Disgust ', ' 5.7%')
(u'Fear ', ' 7.2%')
(u'Joy ', ' 14.7%')
(u'Sadness ', ' 30.2%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 92.0%')
()
Social Tone
-----------
(u'Openness ', ' 13.9%')
(u'Conscientiousness ', ' 23.2%')
(u'Extraversion ', ' 52.8%')
(u'Agreeableness ', ' 45.9%')
(u'Emotional Range ', ' 3.3%')
()
Emotion Tone
------------
(u'Anger ', ' 11.2%')
(u'Disgust ', ' 6.0%')
(u'Fear ', ' 2.1%')
(u'Joy ', ' 66.0%')
(u'Sadness ', ' 4.6%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 8.4%')
(u'Conscientiousness ', ' 31.0%')
(u'Extraversion ', ' 79.5%')
(u'Agreeableness ', ' 76.7%')
(u'Emotional Range ', ' 13.3%')
()
Emotion Tone
------------
(u'Anger ', ' 13.8%')
(u'Disgust ', ' 5.4%')
(u'Fear ', ' 3.9%')
(u'Joy ', ' 46.5%')
(u'Sadness ', ' 16.6%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 29.1%')
()
Social Tone
-----------
(u'Openness ', ' 5.9%')
(u'Conscientiousness ', ' 29.9%')
(u'Extraversion ', ' 56.4%')
(u'Agreeableness ', ' 88.8%')
(u'Emotional Range ', ' 13.0%')
()
Emotion Tone
------------
(u'Anger ', ' 28.5%')
(u'Disgust ', ' 10.6%')
(u'Fear ', ' 16.2%')
(u'Joy ', ' 2.1%')
(u'Sadness ', ' 55.1%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 85.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 1.7%')
(u'Conscientiousness ', ' 14.0%')
(u'Extraversion ', ' 30.4%')
(u'Agreeableness ', ' 48.3%')
(u'Emotional Range ', ' 2.8%')
()
Emotion Tone
------------
(u'Anger ', ' 57.9%')
(u'Disgust ', ' 21.1%')
(u'Fear ', ' 5.9%')
(u'Joy ', ' 3.4%')
(u'Sadness ', ' 25.8%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 26.4%')
(u'Conscientiousness ', ' 24.5%')
(u'Extraversion ', ' 61.0%')
(u'Agreeableness ', ' 58.7%')
(u'Emotional Range ', ' 6.8%')
()
Emotion Tone
------------
(u'Anger ', ' 34.6%')
(u'Disgust ', ' 24.6%')
(u'Fear ', ' 4.4%')
(u'Joy ', ' 4.4%')
(u'Sadness ', ' 43.8%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 75.2%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 11.6%')
(u'Conscientiousness ', ' 14.5%')
(u'Extraversion ', ' 67.0%')
(u'Agreeableness ', ' 69.6%')
(u'Emotional Range ', ' 0.1%')
()
Emotion Tone
------------
(u'Anger ', ' 17.2%')
(u'Disgust ', ' 28.0%')
(u'Fear ', ' 2.5%')
(u'Joy ', ' 39.9%')
(u'Sadness ', ' 5.1%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 5.5%')
(u'Conscientiousness ', ' 62.6%')
(u'Extraversion ', ' 30.3%')
(u'Agreeableness ', ' 44.0%')
(u'Emotional Range ', ' 55.4%')
()
Emotion Tone
------------
(u'Anger ', ' 14.0%')
(u'Disgust ', ' 14.6%')
(u'Fear ', ' 11.9%')
(u'Joy ', ' 30.8%')
(u'Sadness ', ' 19.3%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 10.7%')
(u'Conscientiousness ', ' 33.5%')
(u'Extraversion ', ' 48.2%')
(u'Agreeableness ', ' 68.6%')
(u'Emotional Range ', ' 7.9%')
()
Emotion Tone
------------
(u'Anger ', ' 13.5%')
(u'Disgust ', ' 9.1%')
(u'Fear ', ' 15.4%')
(u'Joy ', ' 18.7%')
(u'Sadness ', ' 36.5%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 45.5%')
(u'Conscientiousness ', ' 29.8%')
(u'Extraversion ', ' 60.3%')
(u'Agreeableness ', ' 62.0%')
(u'Emotional Range ', ' 18.7%')
()
Emotion Tone
------------
(u'Anger ', ' 55.9%')
(u'Disgust ', ' 32.2%')
(u'Fear ', ' 7.2%')
(u'Joy ', ' 1.8%')
(u'Sadness ', ' 21.8%')
()
Writing Tone
------------
(u'Analytical ', ' 2.9%')
(u'Confident ', ' 22.6%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 32.0%')
(u'Conscientiousness ', ' 0.0%')
(u'Extraversion ', ' 63.0%')
(u'Agreeableness ', ' 63.9%')
(u'Emotional Range ', ' 0.0%')
()
Emotion Tone
------------
(u'Anger ', ' 25.9%')
(u'Disgust ', ' 13.9%')
(u'Fear ', ' 19.3%')
(u'Joy ', ' 9.4%')
(u'Sadness ', ' 36.8%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 82.2%')
()
Social Tone
-----------
(u'Openness ', ' 16.6%')
(u'Conscientiousness ', ' 29.8%')
(u'Extraversion ', ' 40.9%')
(u'Agreeableness ', ' 39.3%')
(u'Emotional Range ', ' 13.5%')
()
Emotion Tone
------------
(u'Anger ', ' 12.1%')
(u'Disgust ', ' 18.1%')
(u'Fear ', ' 7.5%')
(u'Joy ', ' 11.1%')
(u'Sadness ', ' 51.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 26.8%')
(u'Conscientiousness ', ' 30.9%')
(u'Extraversion ', ' 27.5%')
(u'Agreeableness ', ' 27.1%')
(u'Emotional Range ', ' 22.2%')
()
Emotion Tone
------------
(u'Anger ', ' 36.0%')
(u'Disgust ', ' 11.9%')
(u'Fear ', ' 14.9%')
(u'Joy ', ' 0.7%')
(u'Sadness ', ' 51.7%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 48.7%')
(u'Conscientiousness ', ' 13.3%')
(u'Extraversion ', ' 14.6%')
(u'Agreeableness ', ' 34.2%')
(u'Emotional Range ', ' 0.2%')
()
Emotion Tone
------------
(u'Anger ', ' 17.5%')
(u'Disgust ', ' 3.7%')
(u'Fear ', ' 5.3%')
(u'Joy ', ' 54.9%')
(u'Sadness ', ' 6.9%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 10.5%')
(u'Conscientiousness ', ' 19.3%')
(u'Extraversion ', ' 64.8%')
(u'Agreeableness ', ' 56.7%')
(u'Emotional Range ', ' 13.3%')
()
Emotion Tone
------------
(u'Anger ', ' 30.8%')
(u'Disgust ', ' 39.0%')
(u'Fear ', ' 6.4%')
(u'Joy ', ' 14.4%')
(u'Sadness ', ' 14.5%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 39.7%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 9.4%')
(u'Conscientiousness ', ' 34.1%')
(u'Extraversion ', ' 63.7%')
(u'Agreeableness ', ' 79.8%')
(u'Emotional Range ', ' 40.0%')
()
Emotion Tone
------------
(u'Anger ', ' 0.0%')
(u'Disgust ', ' 0.0%')
(u'Fear ', ' 0.0%')
(u'Joy ', ' 0.0%')
(u'Sadness ', ' 0.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 6.1%')
(u'Conscientiousness ', ' 24.7%')
(u'Extraversion ', ' 51.4%')
(u'Agreeableness ', ' 54.0%')
(u'Emotional Range ', ' 2.6%')
()
Emotion Tone
------------
(u'Anger ', ' 22.6%')
(u'Disgust ', ' 34.7%')
(u'Fear ', ' 15.5%')
(u'Joy ', ' 6.2%')
(u'Sadness ', ' 32.2%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 2.6%')
(u'Conscientiousness ', ' 8.1%')
(u'Extraversion ', ' 62.8%')
(u'Agreeableness ', ' 50.1%')
(u'Emotional Range ', ' 0.0%')
()
Emotion Tone
------------
(u'Anger ', ' 44.3%')
(u'Disgust ', ' 5.6%')
(u'Fear ', ' 9.2%')
(u'Joy ', ' 0.5%')
(u'Sadness ', ' 54.8%')
()
Writing Tone
------------
(u'Analytical ', ' 12.1%')
(u'Confident ', ' 50.9%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 1.2%')
(u'Conscientiousness ', ' 2.9%')
(u'Extraversion ', ' 1.2%')
(u'Agreeableness ', ' 43.8%')
(u'Emotional Range ', ' 0.3%')
()
Emotion Tone
------------
(u'Anger ', ' 25.0%')
(u'Disgust ', ' 20.2%')
(u'Fear ', ' 3.9%')
(u'Joy ', ' 0.3%')
(u'Sadness ', ' 65.5%')
()
Writing Tone
------------
(u'Analytical ', ' 67.2%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 75.2%')
()
Social Tone
-----------
(u'Openness ', ' 23.1%')
(u'Conscientiousness ', ' 5.9%')
(u'Extraversion ', ' 33.0%')
(u'Agreeableness ', ' 66.8%')
(u'Emotional Range ', ' 0.5%')
()
Emotion Tone
------------
(u'Anger ', ' 22.0%')
(u'Disgust ', ' 39.2%')
(u'Fear ', ' 19.7%')
(u'Joy ', ' 0.8%')
(u'Sadness ', ' 37.5%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 0.2%')
(u'Conscientiousness ', ' 24.5%')
(u'Extraversion ', ' 11.8%')
(u'Agreeableness ', ' 38.8%')
(u'Emotional Range ', ' 1.4%')
()
Emotion Tone
------------
(u'Anger ', ' 39.2%')
(u'Disgust ', ' 13.6%')
(u'Fear ', ' 6.2%')
(u'Joy ', ' 21.0%')
(u'Sadness ', ' 17.5%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 23.6%')
()
Social Tone
-----------
(u'Openness ', ' 2.4%')
(u'Conscientiousness ', ' 10.4%')
(u'Extraversion ', ' 63.3%')
(u'Agreeableness ', ' 72.0%')
(u'Emotional Range ', ' 0.6%')
()
Emotion Tone
------------
(u'Anger ', ' 22.8%')
(u'Disgust ', ' 23.0%')
(u'Fear ', ' 13.5%')
(u'Joy ', ' 20.2%')
(u'Sadness ', ' 19.2%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 92.1%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 2.0%')
(u'Conscientiousness ', ' 13.8%')
(u'Extraversion ', ' 70.9%')
(u'Agreeableness ', ' 75.1%')
(u'Emotional Range ', ' 1.9%')
()
Emotion Tone
------------
(u'Anger ', ' 17.2%')
(u'Disgust ', ' 15.0%')
(u'Fear ', ' 4.9%')
(u'Joy ', ' 41.1%')
(u'Sadness ', ' 11.6%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 97.8%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 18.9%')
(u'Conscientiousness ', ' 33.9%')
(u'Extraversion ', ' 34.2%')
(u'Agreeableness ', ' 44.6%')
(u'Emotional Range ', ' 25.3%')
()
Emotion Tone
------------
(u'Anger ', ' 14.0%')
(u'Disgust ', ' 6.2%')
(u'Fear ', ' 8.4%')
(u'Joy ', ' 23.6%')
(u'Sadness ', ' 37.6%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 66.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 11.2%')
(u'Conscientiousness ', ' 4.0%')
(u'Extraversion ', ' 91.5%')
(u'Agreeableness ', ' 86.1%')
(u'Emotional Range ', ' 1.8%')
()
Emotion Tone
------------
(u'Anger ', ' 20.0%')
(u'Disgust ', ' 47.8%')
(u'Fear ', ' 22.0%')
(u'Joy ', ' 0.0%')
(u'Sadness ', ' 31.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 0.8%')
(u'Conscientiousness ', ' 5.5%')
(u'Extraversion ', ' 34.3%')
(u'Agreeableness ', ' 56.6%')
(u'Emotional Range ', ' 0.0%')
()
Emotion Tone
------------
(u'Anger ', ' 25.6%')
(u'Disgust ', ' 1.7%')
(u'Fear ', ' 6.4%')
(u'Joy ', ' 11.9%')
(u'Sadness ', ' 51.3%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 1.6%')
(u'Conscientiousness ', ' 47.4%')
(u'Extraversion ', ' 21.3%')
(u'Agreeableness ', ' 50.4%')
(u'Emotional Range ', ' 30.5%')
()
Emotion Tone
------------
(u'Anger ', ' 42.1%')
(u'Disgust ', ' 15.4%')
(u'Fear ', ' 10.3%')
(u'Joy ', ' 1.4%')
(u'Sadness ', ' 46.5%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 82.2%')
()
Social Tone
-----------
(u'Openness ', ' 1.7%')
(u'Conscientiousness ', ' 24.2%')
(u'Extraversion ', ' 4.9%')
(u'Agreeableness ', ' 29.4%')
(u'Emotional Range ', ' 5.9%')
()
Emotion Tone
------------
(u'Anger ', ' 20.9%')
(u'Disgust ', ' 7.3%')
(u'Fear ', ' 2.2%')
(u'Joy ', ' 45.1%')
(u'Sadness ', ' 12.6%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 9.5%')
(u'Conscientiousness ', ' 29.0%')
(u'Extraversion ', ' 51.9%')
(u'Agreeableness ', ' 62.9%')
(u'Emotional Range ', ' 8.3%')
()
Emotion Tone
------------
(u'Anger ', ' 17.3%')
(u'Disgust ', ' 2.6%')
(u'Fear ', ' 4.1%')
(u'Joy ', ' 14.6%')
(u'Sadness ', ' 55.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 39.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 3.2%')
(u'Conscientiousness ', ' 41.5%')
(u'Extraversion ', ' 28.5%')
(u'Agreeableness ', ' 43.1%')
(u'Emotional Range ', ' 19.2%')
()
Emotion Tone
------------
(u'Anger ', ' 35.0%')
(u'Disgust ', ' 10.3%')
(u'Fear ', ' 4.4%')
(u'Joy ', ' 2.8%')
(u'Sadness ', ' 57.9%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 96.2%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 5.4%')
(u'Conscientiousness ', ' 43.6%')
(u'Extraversion ', ' 44.9%')
(u'Agreeableness ', ' 62.3%')
(u'Emotional Range ', ' 17.7%')
()
Emotion Tone
------------
(u'Anger ', ' 13.9%')
(u'Disgust ', ' 4.8%')
(u'Fear ', ' 11.0%')
(u'Joy ', ' 28.4%')
(u'Sadness ', ' 30.4%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 24.4%')
(u'Conscientiousness ', ' 27.5%')
(u'Extraversion ', ' 53.0%')
(u'Agreeableness ', ' 56.4%')
(u'Emotional Range ', ' 20.9%')
()
Emotion Tone
------------
(u'Anger ', ' 8.9%')
(u'Disgust ', ' 3.1%')
(u'Fear ', ' 2.8%')
(u'Joy ', ' 70.6%')
(u'Sadness ', ' 4.6%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 16.6%')
(u'Conscientiousness ', ' 26.7%')
(u'Extraversion ', ' 69.6%')
(u'Agreeableness ', ' 61.5%')
(u'Emotional Range ', ' 10.2%')
()
Emotion Tone
------------
(u'Anger ', ' 1.4%')
(u'Disgust ', ' 0.3%')
(u'Fear ', ' 1.6%')
(u'Joy ', ' 84.7%')
(u'Sadness ', ' 4.8%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 0.4%')
(u'Conscientiousness ', ' 20.2%')
(u'Extraversion ', ' 70.1%')
(u'Agreeableness ', ' 74.2%')
(u'Emotional Range ', ' 27.3%')
()
Emotion Tone
------------
(u'Anger ', ' 40.5%')
(u'Disgust ', ' 5.6%')
(u'Fear ', ' 4.8%')
(u'Joy ', ' 22.8%')
(u'Sadness ', ' 20.7%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 6.0%')
(u'Conscientiousness ', ' 21.2%')
(u'Extraversion ', ' 37.9%')
(u'Agreeableness ', ' 30.9%')
(u'Emotional Range ', ' 14.8%')
()
Emotion Tone
------------
(u'Anger ', ' 18.8%')
(u'Disgust ', ' 18.2%')
(u'Fear ', ' 40.8%')
(u'Joy ', ' 1.5%')
(u'Sadness ', ' 35.9%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 37.4%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 32.4%')
(u'Conscientiousness ', ' 0.1%')
(u'Extraversion ', ' 49.2%')
(u'Agreeableness ', ' 79.1%')
(u'Emotional Range ', ' 1.7%')
()
Emotion Tone
------------
(u'Anger ', ' 7.8%')
(u'Disgust ', ' 3.3%')
(u'Fear ', ' 1.2%')
(u'Joy ', ' 74.2%')
(u'Sadness ', ' 4.4%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 15.3%')
(u'Conscientiousness ', ' 30.9%')
(u'Extraversion ', ' 92.4%')
(u'Agreeableness ', ' 97.6%')
(u'Emotional Range ', ' 28.1%')
()
Emotion Tone
------------
(u'Anger ', ' 21.7%')
(u'Disgust ', ' 14.6%')
(u'Fear ', ' 14.1%')
(u'Joy ', ' 16.6%')
(u'Sadness ', ' 31.4%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 7.9%')
(u'Conscientiousness ', ' 32.8%')
(u'Extraversion ', ' 25.5%')
(u'Agreeableness ', ' 45.4%')
(u'Emotional Range ', ' 12.4%')
()
Emotion Tone
------------
(u'Anger ', ' 21.6%')
(u'Disgust ', ' 25.8%')
(u'Fear ', ' 9.0%')
(u'Joy ', ' 25.8%')
(u'Sadness ', ' 14.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 1.3%')
(u'Conscientiousness ', ' 5.5%')
(u'Extraversion ', ' 45.9%')
(u'Agreeableness ', ' 73.8%')
(u'Emotional Range ', ' 9.5%')
()
Emotion Tone
------------
(u'Anger ', ' 25.2%')
(u'Disgust ', ' 9.1%')
(u'Fear ', ' 10.3%')
(u'Joy ', ' 10.6%')
(u'Sadness ', ' 45.6%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 80.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 4.5%')
(u'Conscientiousness ', ' 22.9%')
(u'Extraversion ', ' 18.5%')
(u'Agreeableness ', ' 41.8%')
(u'Emotional Range ', ' 9.0%')
()
Emotion Tone
------------
(u'Anger ', ' 45.5%')
(u'Disgust ', ' 11.7%')
(u'Fear ', ' 17.2%')
(u'Joy ', ' 0.1%')
(u'Sadness ', ' 43.6%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 39.7%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 59.3%')
(u'Conscientiousness ', ' 29.4%')
(u'Extraversion ', ' 71.4%')
(u'Agreeableness ', ' 72.5%')
(u'Emotional Range ', ' 9.3%')
()
Emotion Tone
------------
(u'Anger ', ' 17.7%')
(u'Disgust ', ' 39.7%')
(u'Fear ', ' 20.1%')
(u'Joy ', ' 3.0%')
(u'Sadness ', ' 34.3%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 94.6%')
()
Social Tone
-----------
(u'Openness ', ' 6.1%')
(u'Conscientiousness ', ' 19.5%')
(u'Extraversion ', ' 25.2%')
(u'Agreeableness ', ' 61.9%')
(u'Emotional Range ', ' 13.9%')
()
Emotion Tone
------------
(u'Anger ', ' 0.0%')
(u'Disgust ', ' 0.0%')
(u'Fear ', ' 0.0%')
(u'Joy ', ' 0.0%')
(u'Sadness ', ' 0.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 6.1%')
(u'Conscientiousness ', ' 24.7%')
(u'Extraversion ', ' 51.4%')
(u'Agreeableness ', ' 54.0%')
(u'Emotional Range ', ' 2.6%')
()
Emotion Tone
------------
(u'Anger ', ' 24.3%')
(u'Disgust ', ' 4.5%')
(u'Fear ', ' 67.6%')
(u'Joy ', ' 0.2%')
(u'Sadness ', ' 17.7%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 79.4%')
()
Social Tone
-----------
(u'Openness ', ' 9.3%')
(u'Conscientiousness ', ' 12.6%')
(u'Extraversion ', ' 22.9%')
(u'Agreeableness ', ' 22.9%')
(u'Emotional Range ', ' 2.9%')
()
Emotion Tone
------------
(u'Anger ', ' 11.6%')
(u'Disgust ', ' 0.9%')
(u'Fear ', ' 79.9%')
(u'Joy ', ' 4.0%')
(u'Sadness ', ' 6.4%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 14.4%')
()
Social Tone
-----------
(u'Openness ', ' 5.1%')
(u'Conscientiousness ', ' 0.9%')
(u'Extraversion ', ' 63.7%')
(u'Agreeableness ', ' 95.2%')
(u'Emotional Range ', ' 0.0%')
()
Emotion Tone
------------
(u'Anger ', ' 7.3%')
(u'Disgust ', ' 6.4%')
(u'Fear ', ' 0.8%')
(u'Joy ', ' 70.3%')
(u'Sadness ', ' 5.4%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 3.8%')
(u'Conscientiousness ', ' 13.8%')
(u'Extraversion ', ' 84.1%')
(u'Agreeableness ', ' 86.9%')
(u'Emotional Range ', ' 22.5%')
()
Emotion Tone
------------
(u'Anger ', ' 14.1%')
(u'Disgust ', ' 4.3%')
(u'Fear ', ' 17.7%')
(u'Joy ', ' 0.0%')
(u'Sadness ', ' 74.1%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 0.7%')
(u'Conscientiousness ', ' 16.5%')
(u'Extraversion ', ' 48.2%')
(u'Agreeableness ', ' 69.6%')
(u'Emotional Range ', ' 0.0%')
()
Emotion Tone
------------
(u'Anger ', ' 15.2%')
(u'Disgust ', ' 17.0%')
(u'Fear ', ' 4.3%')
(u'Joy ', ' 39.3%')
(u'Sadness ', ' 14.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 75.2%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 30.3%')
(u'Conscientiousness ', ' 12.8%')
(u'Extraversion ', ' 74.1%')
(u'Agreeableness ', ' 48.3%')
(u'Emotional Range ', ' 6.3%')
()
Emotion Tone
------------
(u'Anger ', ' 20.8%')
(u'Disgust ', ' 33.7%')
(u'Fear ', ' 8.1%')
(u'Joy ', ' 18.7%')
(u'Sadness ', ' 18.6%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 5.6%')
(u'Conscientiousness ', ' 28.5%')
(u'Extraversion ', ' 47.5%')
(u'Agreeableness ', ' 54.6%')
(u'Emotional Range ', ' 16.1%')
()
Emotion Tone
------------
(u'Anger ', ' 39.3%')
(u'Disgust ', ' 16.8%')
(u'Fear ', ' 7.6%')
(u'Joy ', ' 0.5%')
(u'Sadness ', ' 52.5%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 21.3%')
()
Social Tone
-----------
(u'Openness ', ' 7.5%')
(u'Conscientiousness ', ' 24.2%')
(u'Extraversion ', ' 13.8%')
(u'Agreeableness ', ' 10.7%')
(u'Emotional Range ', ' 21.1%')
()
Emotion Tone
------------
(u'Anger ', ' 22.6%')
(u'Disgust ', ' 9.7%')
(u'Fear ', ' 61.4%')
(u'Joy ', ' 4.7%')
(u'Sadness ', ' 11.0%')
()
Writing Tone
------------
(u'Analytical ', ' 72.4%')
(u'Confident ', ' 87.4%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 39.1%')
(u'Conscientiousness ', ' 6.9%')
(u'Extraversion ', ' 25.5%')
(u'Agreeableness ', ' 72.7%')
(u'Emotional Range ', ' 0.0%')
()
Emotion Tone
------------
(u'Anger ', ' 31.7%')
(u'Disgust ', ' 11.2%')
(u'Fear ', ' 15.6%')
(u'Joy ', ' 0.7%')
(u'Sadness ', ' 55.7%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 85.0%')
()
Social Tone
-----------
(u'Openness ', ' 14.2%')
(u'Conscientiousness ', ' 1.5%')
(u'Extraversion ', ' 50.4%')
(u'Agreeableness ', ' 96.2%')
(u'Emotional Range ', ' 0.0%')
()
Emotion Tone
------------
(u'Anger ', ' 34.9%')
(u'Disgust ', ' 18.9%')
(u'Fear ', ' 3.3%')
(u'Joy ', ' 19.9%')
(u'Sadness ', ' 21.8%')
()
Writing Tone
------------
(u'Analytical ', ' 11.6%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 36.3%')
(u'Conscientiousness ', ' 29.4%')
(u'Extraversion ', ' 40.2%')
(u'Agreeableness ', ' 53.6%')
(u'Emotional Range ', ' 39.1%')
()
Emotion Tone
------------
(u'Anger ', ' 64.8%')
(u'Disgust ', ' 27.7%')
(u'Fear ', ' 14.3%')
(u'Joy ', ' 1.2%')
(u'Sadness ', ' 11.4%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 61.8%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 30.7%')
(u'Conscientiousness ', ' 20.0%')
(u'Extraversion ', ' 70.1%')
(u'Agreeableness ', ' 75.9%')
(u'Emotional Range ', ' 6.8%')
()
Emotion Tone
------------
(u'Anger ', ' 14.9%')
(u'Disgust ', ' 13.9%')
(u'Fear ', ' 37.1%')
(u'Joy ', ' 2.2%')
(u'Sadness ', ' 43.9%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 3.3%')
(u'Conscientiousness ', ' 20.3%')
(u'Extraversion ', ' 43.5%')
(u'Agreeableness ', ' 49.6%')
(u'Emotional Range ', ' 4.1%')
()
Emotion Tone
------------
(u'Anger ', ' 8.8%')
(u'Disgust ', ' 8.0%')
(u'Fear ', ' 2.3%')
(u'Joy ', ' 65.8%')
(u'Sadness ', ' 4.8%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 33.3%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 3.0%')
(u'Conscientiousness ', ' 28.9%')
(u'Extraversion ', ' 31.9%')
(u'Agreeableness ', ' 54.5%')
(u'Emotional Range ', ' 15.0%')
()
Emotion Tone
------------
(u'Anger ', ' 30.8%')
(u'Disgust ', ' 22.5%')
(u'Fear ', ' 25.0%')
(u'Joy ', ' 3.2%')
(u'Sadness ', ' 33.6%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 24.2%')
(u'Conscientiousness ', ' 27.2%')
(u'Extraversion ', ' 46.5%')
(u'Agreeableness ', ' 61.8%')
(u'Emotional Range ', ' 2.7%')
()
Emotion Tone
------------
(u'Anger ', ' 14.9%')
(u'Disgust ', ' 13.9%')
(u'Fear ', ' 37.1%')
(u'Joy ', ' 2.2%')
(u'Sadness ', ' 43.9%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 3.3%')
(u'Conscientiousness ', ' 20.3%')
(u'Extraversion ', ' 43.5%')
(u'Agreeableness ', ' 49.6%')
(u'Emotional Range ', ' 4.1%')
()
Emotion Tone
------------
(u'Anger ', ' 0.0%')
(u'Disgust ', ' 0.0%')
(u'Fear ', ' 0.0%')
(u'Joy ', ' 0.0%')
(u'Sadness ', ' 0.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 6.1%')
(u'Conscientiousness ', ' 24.7%')
(u'Extraversion ', ' 51.4%')
(u'Agreeableness ', ' 54.0%')
(u'Emotional Range ', ' 2.6%')
()
Emotion Tone
------------
(u'Anger ', ' 8.0%')
(u'Disgust ', ' 54.6%')
(u'Fear ', ' 3.2%')
(u'Joy ', ' 0.2%')
(u'Sadness ', ' 48.7%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 44.9%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 5.6%')
(u'Conscientiousness ', ' 23.3%')
(u'Extraversion ', ' 42.7%')
(u'Agreeableness ', ' 59.1%')
(u'Emotional Range ', ' 10.5%')
()
Emotion Tone
------------
(u'Anger ', ' 34.6%')
(u'Disgust ', ' 42.9%')
(u'Fear ', ' 8.1%')
(u'Joy ', ' 1.7%')
(u'Sadness ', ' 31.4%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 92.1%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 3.9%')
(u'Conscientiousness ', ' 17.2%')
(u'Extraversion ', ' 3.0%')
(u'Agreeableness ', ' 57.1%')
(u'Emotional Range ', ' 0.1%')
()
Emotion Tone
------------
(u'Anger ', ' 28.7%')
(u'Disgust ', ' 26.6%')
(u'Fear ', ' 22.5%')
(u'Joy ', ' 4.7%')
(u'Sadness ', ' 31.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 61.8%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 2.7%')
(u'Conscientiousness ', ' 11.8%')
(u'Extraversion ', ' 30.5%')
(u'Agreeableness ', ' 49.5%')
(u'Emotional Range ', ' 43.0%')
()
Emotion Tone
------------
(u'Anger ', ' 38.4%')
(u'Disgust ', ' 11.3%')
(u'Fear ', ' 27.5%')
(u'Joy ', ' 5.1%')
(u'Sadness ', ' 29.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 10.7%')
(u'Conscientiousness ', ' 19.0%')
(u'Extraversion ', ' 41.0%')
(u'Agreeableness ', ' 61.1%')
(u'Emotional Range ', ' 0.6%')
()
Emotion Tone
------------
(u'Anger ', ' 26.3%')
(u'Disgust ', ' 10.1%')
(u'Fear ', ' 7.5%')
(u'Joy ', ' 0.1%')
(u'Sadness ', ' 69.4%')
()
Writing Tone
------------
(u'Analytical ', ' 17.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 68.2%')
()
Social Tone
-----------
(u'Openness ', ' 5.1%')
(u'Conscientiousness ', ' 4.1%')
(u'Extraversion ', ' 19.8%')
(u'Agreeableness ', ' 88.9%')
(u'Emotional Range ', ' 0.3%')
()
Emotion Tone
------------
(u'Anger ', ' 14.9%')
(u'Disgust ', ' 1.7%')
(u'Fear ', ' 14.7%')
(u'Joy ', ' 0.5%')
(u'Sadness ', ' 76.3%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 14.5%')
(u'Conscientiousness ', ' 48.3%')
(u'Extraversion ', ' 42.4%')
(u'Agreeableness ', ' 68.7%')
(u'Emotional Range ', ' 24.0%')
()
Emotion Tone
------------
(u'Anger ', ' 20.9%')
(u'Disgust ', ' 22.2%')
(u'Fear ', ' 7.0%')
(u'Joy ', ' 0.8%')
(u'Sadness ', ' 63.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 96.8%')
()
Social Tone
-----------
(u'Openness ', ' 8.0%')
(u'Conscientiousness ', ' 8.7%')
(u'Extraversion ', ' 57.4%')
(u'Agreeableness ', ' 88.4%')
(u'Emotional Range ', ' 0.4%')
()
Emotion Tone
------------
(u'Anger ', ' 61.5%')
(u'Disgust ', ' 27.2%')
(u'Fear ', ' 4.2%')
(u'Joy ', ' 0.3%')
(u'Sadness ', ' 26.2%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 50.5%')
(u'Conscientiousness ', ' 2.7%')
(u'Extraversion ', ' 65.6%')
(u'Agreeableness ', ' 67.0%')
(u'Emotional Range ', ' 1.8%')
()
Emotion Tone
------------
(u'Anger ', ' 26.8%')
(u'Disgust ', ' 72.3%')
(u'Fear ', ' 8.8%')
(u'Joy ', ' 1.1%')
(u'Sadness ', ' 8.7%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 77.5%')
()
Social Tone
-----------
(u'Openness ', ' 2.4%')
(u'Conscientiousness ', ' 19.6%')
(u'Extraversion ', ' 37.3%')
(u'Agreeableness ', ' 33.5%')
(u'Emotional Range ', ' 24.6%')
()
Emotion Tone
------------
(u'Anger ', ' 27.0%')
(u'Disgust ', ' 64.7%')
(u'Fear ', ' 11.0%')
(u'Joy ', ' 3.5%')
(u'Sadness ', ' 9.3%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 29.2%')
(u'Conscientiousness ', ' 41.4%')
(u'Extraversion ', ' 56.6%')
(u'Agreeableness ', ' 63.1%')
(u'Emotional Range ', ' 38.0%')
()
Emotion Tone
------------
(u'Anger ', ' 42.7%')
(u'Disgust ', ' 7.2%')
(u'Fear ', ' 24.0%')
(u'Joy ', ' 13.6%')
(u'Sadness ', ' 15.1%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 66.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 3.9%')
(u'Conscientiousness ', ' 8.7%')
(u'Extraversion ', ' 21.0%')
(u'Agreeableness ', ' 62.5%')
(u'Emotional Range ', ' 0.7%')
()
Emotion Tone
------------
(u'Anger ', ' 43.4%')
(u'Disgust ', ' 51.7%')
(u'Fear ', ' 5.9%')
(u'Joy ', ' 0.2%')
(u'Sadness ', ' 21.1%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 1.5%')
(u'Conscientiousness ', ' 8.0%')
(u'Extraversion ', ' 37.0%')
(u'Agreeableness ', ' 36.0%')
(u'Emotional Range ', ' 7.8%')
()
Emotion Tone
------------
(u'Anger ', ' 23.5%')
(u'Disgust ', ' 78.0%')
(u'Fear ', ' 3.7%')
(u'Joy ', ' 0.3%')
(u'Sadness ', ' 10.8%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 11.1%')
(u'Conscientiousness ', ' 19.5%')
(u'Extraversion ', ' 57.9%')
(u'Agreeableness ', ' 64.0%')
(u'Emotional Range ', ' 48.1%')
()
Emotion Tone
------------
(u'Anger ', ' 36.7%')
(u'Disgust ', ' 36.0%')
(u'Fear ', ' 7.6%')
(u'Joy ', ' 0.0%')
(u'Sadness ', ' 40.5%')
()
Writing Tone
------------
(u'Analytical ', ' 46.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 34.4%')
()
Social Tone
-----------
(u'Openness ', ' 11.0%')
(u'Conscientiousness ', ' 14.3%')
(u'Extraversion ', ' 55.3%')
(u'Agreeableness ', ' 41.6%')
(u'Emotional Range ', ' 34.6%')
()
Emotion Tone
------------
(u'Anger ', ' 11.6%')
(u'Disgust ', ' 21.6%')
(u'Fear ', ' 3.0%')
(u'Joy ', ' 21.0%')
(u'Sadness ', ' 36.1%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 2.4%')
(u'Conscientiousness ', ' 30.1%')
(u'Extraversion ', ' 25.3%')
(u'Agreeableness ', ' 41.2%')
(u'Emotional Range ', ' 12.3%')
()
Emotion Tone
------------
(u'Anger ', ' 28.3%')
(u'Disgust ', ' 7.9%')
(u'Fear ', ' 31.4%')
(u'Joy ', ' 6.8%')
(u'Sadness ', ' 33.1%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 82.2%')
()
Social Tone
-----------
(u'Openness ', ' 13.9%')
(u'Conscientiousness ', ' 10.1%')
(u'Extraversion ', ' 51.1%')
(u'Agreeableness ', ' 60.3%')
(u'Emotional Range ', ' 0.3%')
()
Emotion Tone
------------
(u'Anger ', ' 11.3%')
(u'Disgust ', ' 9.1%')
(u'Fear ', ' 11.5%')
(u'Joy ', ' 37.7%')
(u'Sadness ', ' 18.2%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 4.5%')
(u'Conscientiousness ', ' 20.2%')
(u'Extraversion ', ' 40.5%')
(u'Agreeableness ', ' 66.5%')
(u'Emotional Range ', ' 0.8%')
()
Emotion Tone
------------
(u'Anger ', ' 5.2%')
(u'Disgust ', ' 4.0%')
(u'Fear ', ' 1.0%')
(u'Joy ', ' 70.4%')
(u'Sadness ', ' 8.3%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 64.8%')
()
Social Tone
-----------
(u'Openness ', ' 11.4%')
(u'Conscientiousness ', ' 2.9%')
(u'Extraversion ', ' 48.4%')
(u'Agreeableness ', ' 85.6%')
(u'Emotional Range ', ' 0.2%')
()
Emotion Tone
------------
(u'Anger ', ' 0.0%')
(u'Disgust ', ' 0.0%')
(u'Fear ', ' 0.0%')
(u'Joy ', ' 0.0%')
(u'Sadness ', ' 0.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 6.1%')
(u'Conscientiousness ', ' 24.7%')
(u'Extraversion ', ' 51.4%')
(u'Agreeableness ', ' 54.0%')
(u'Emotional Range ', ' 2.6%')
()
Emotion Tone
------------
(u'Anger ', ' 34.0%')
(u'Disgust ', ' 15.8%')
(u'Fear ', ' 26.9%')
(u'Joy ', ' 1.3%')
(u'Sadness ', ' 38.8%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 35.6%')
(u'Conscientiousness ', ' 37.1%')
(u'Extraversion ', ' 43.0%')
(u'Agreeableness ', ' 61.2%')
(u'Emotional Range ', ' 34.5%')
()
Emotion Tone
------------
(u'Anger ', ' 9.7%')
(u'Disgust ', ' 16.5%')
(u'Fear ', ' 11.6%')
(u'Joy ', ' 29.7%')
(u'Sadness ', ' 22.7%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 85.7%')
()
Social Tone
-----------
(u'Openness ', ' 23.4%')
(u'Conscientiousness ', ' 25.8%')
(u'Extraversion ', ' 59.1%')
(u'Agreeableness ', ' 60.3%')
(u'Emotional Range ', ' 16.8%')
()
Emotion Tone
------------
(u'Anger ', ' 25.8%')
(u'Disgust ', ' 24.9%')
(u'Fear ', ' 19.8%')
(u'Joy ', ' 1.1%')
(u'Sadness ', ' 45.7%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 41.5%')
(u'Conscientiousness ', ' 31.2%')
(u'Extraversion ', ' 48.3%')
(u'Agreeableness ', ' 63.0%')
(u'Emotional Range ', ' 13.2%')
()
Emotion Tone
------------
(u'Anger ', ' 0.0%')
(u'Disgust ', ' 0.0%')
(u'Fear ', ' 0.0%')
(u'Joy ', ' 0.0%')
(u'Sadness ', ' 0.0%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 6.1%')
(u'Conscientiousness ', ' 24.7%')
(u'Extraversion ', ' 51.4%')
(u'Agreeableness ', ' 54.0%')
(u'Emotional Range ', ' 2.6%')
()
Emotion Tone
------------
(u'Anger ', ' 25.7%')
(u'Disgust ', ' 14.8%')
(u'Fear ', ' 11.3%')
(u'Joy ', ' 17.7%')
(u'Sadness ', ' 28.3%')
()
Writing Tone
------------
(u'Analytical ', ' 0.0%')
(u'Confident ', ' 0.0%')
(u'Tentative ', ' 0.0%')
()
Social Tone
-----------
(u'Openness ', ' 21.8%')
(u'Conscientiousness ', ' 22.6%')
(u'Extraversion ', ' 51.0%')
(u'Agreeableness ', ' 69.5%')
(u'Emotional Range ', ' 3.1%')
()
In [ ]:
import requests
url = 'https://kafka-rest-prod01.messagehub.services.us-south.bluemix.net:443/topics/sentiment'
headers = {'Content-type': 'application/vnd.kafka.json.v1+json',
'X-Auth-Token': '0voZA4gXyOWP4ORu0LxarghaHMZaDwI0eDErLGoYyAProwgB'}
response = requests.put(url, data=tones[0], headers=headers)
print(response)
In [ ]:
response = requests.get('https://kafka-rest-prod01.messagehub.services.us-south.bluemix.net:443/topics/sentiment', headers)
print(response)
In [ ]:
spark_df.saveAsParquetFile("swift://notebooks.spark/surveys.parquet")
Content source: krondor/dsxlunch
Similar notebooks: